package com.itfreer.data.input;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.itfreer.data.input.dao.InputConfigDao;
import com.itfreer.data.input.entity.InputConfigEntity;
import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.DictionaryServiceImp;
import com.itfreer.form.api.dictionary.DictionaryEntity;

/**
 * 数据导入配置
 */
@Component
public class InputConfigServiceImp extends DictionaryServiceImp<InputConfigEntity> implements InputConfigService {

	@Autowired
	private InputConfigDao checkConfigDao;

	@Override
	protected BaseDao<InputConfigEntity> getDao() {
		return checkConfigDao;
	}

	@Override
	public String getDictionaryName() {
		return "d_input_type";
	}

	@Override
	public String getServiceName() {
		return "InputConfigService";
	}

	@Override
	protected DictionaryEntity convert(InputConfigEntity entity) {
		DictionaryEntity toEntity = new DictionaryEntity();
		toEntity.setId(entity.getId());
		toEntity.setCode(entity.getId());
		toEntity.setDisplay(entity.getName());
		toEntity.setValid(true);
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "id,name";
	}
}